import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class CustomInfoPanel extends JPanel {
	public JLabel myTitle;
	public JLabel myText;
	public JPanel north, east;
	private String northLabelPad = "     ";
	public Output o;
	public JLabel myIconLabel;

	public ImageIcon myIcon;

	public CustomInfoPanel(Output arg1) {
		o = arg1;

		// border (top, left, bottom, right, color)
		this.setLayout(new BorderLayout());
		this.setPreferredSize(new Dimension(750, 200));
		this.setBorder(BorderFactory.createCompoundBorder(BorderFactory
				.createMatteBorder(5, 0, 5, 0, Color.white), BorderFactory
				.createMatteBorder(8, 0, 10, 10, new Color(60, 60, 60))));
		this.setBackground(new Color(60, 60, 60));

		north = new JPanel();
		north.setLayout(new BorderLayout());
		north.setBackground(new Color(45, 45, 45));
		north.setBorder(BorderFactory.createMatteBorder(2, 0, 2, 2, new Color(
				25, 25, 25)));
		this.add(north, BorderLayout.NORTH);
		myTitle = new JLabel(northLabelPad + "Game Info");
		myTitle.setForeground(Color.white);
		myTitle.setFont(new Font("Dialog", Font.BOLD, 14));
		north.add(myTitle, BorderLayout.WEST);

		JPanel centerPanel = new JPanel();
		centerPanel.setLayout(new FlowLayout());
		centerPanel.setBackground(new Color(60, 60, 60));
		this.add(centerPanel, BorderLayout.CENTER);
		myText = new JLabel("");
		myText.setForeground(Color.white);
		myText.setFont(new Font("Dialog", Font.PLAIN, 14));
		centerPanel.add(myText);

		east = new JPanel();
		east.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, new Color(
				60, 60, 60)));
		east.setBackground(new Color(60, 60, 60));
		east.setPreferredSize(new Dimension(260, 100));
		this.add(east, BorderLayout.EAST);

		myIconLabel = new JLabel();
		myIconLabel.setPreferredSize(new Dimension(260, 140));
		myIconLabel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2,
				Color.black));
		east.add(myIconLabel);
	}

	public void setText(String arg1) {
		myText.setText(arg1);

		if (arg1.equals("")) {
			east.setBackground(new Color(45, 45, 45));
		}
	}

	public void setTitle(String arg1) {
		myTitle.setText(northLabelPad + arg1);

		if (arg1.equals("")) {
			east.setBackground(new Color(45, 45, 45));
		}
	}

	// Sets information for each game option (Mike is working on it)
	public void setInfo(String arg1) {
		this.setTitle(arg1);
		if (arg1.equals("Classic")) {
			this
					.setText("An abstraction of the Classic map, a favorite for players of all skill levels.");
			this.setImage("sClassic.png");
		} else if (arg1.equals("North America")) {
			this.setText("Fight on the battlegrounds of North America.");
			this.setImage("sNorthAmerica.jpg");
		} else if (arg1.equals("Asia")) {
			this.setText("Take a spin in the far east, historic Asia.");
			this.setImage("sAsia.jpg");
		} else if (arg1.equals("Europe")) {
			this.setText("Modern Europe makes a debut");
			this.setImage("sEurope.jpg");
		}
		if (arg1.equals("3")) {
			this.setText("Creates a 3 player game");
			this.setImage("");
		} else if (arg1.equals("4")) {
			this.setText("Creates a 4 player game");
			this.setImage("");
		} else if (arg1.equals("5")) {
			this.setText("Creates a 5 player game");
			this.setImage("");
		} else if (arg1.equals("6")) {
			this.setText("Creates a 6 player game");
			this.setImage("");
		}
		if (arg1.equals("Free For All")) {
			this
					.setText("Each player attempts to win the game by outlasting and defeating the other players");
			this.setImage("");
		} else if (arg1.equals("Team")) {
			this
					.setText("Players form teams and try to eliminate the other team");
			this.setImage("");
		} else if (arg1.equals("Assassins")) {
			this
					.setText("Each player is assigned another player to eliminate. The player who succeeds first wins");
			this.setImage("");
		} else if (arg1.equals("Newbie")) {
			this.setText("");
			this.setImage("");
		}
		if (arg1.equals("Standard")) {
			this.setText("Cards retain their same value throughout the game");
			this.setImage("");
		} else if (arg1.equals("Escalating")) {
			this
					.setText("The cards increase in value as the game goes along and more people turn in sets of cards");
			this.setImage("");
		} else if (arg1.equals("None")) {
			this.setText("There are no cards used in the game");
			this.setImage("");
		}
		if (arg1.equals("90s")) {
			this.setText("Each turn lasts 90 seconds");
			this.setImage("");
		} else if (arg1.equals("60s")) {
			this.setText("Each turn lasts 60 seconds");
			this.setImage("");
		} else if (arg1.equals("45s")) {
			this.setText("Each turn lasts 45 seconds");
			this.setImage("");
		} else if (arg1.equals("30s")) {
			this.setText("Each turn lasts 30 seconds");
			this.setImage("");
		}

	}

	public void setImage(String arg1) {
		myIcon = new ImageIcon(arg1);
		myIconLabel.setIcon(myIcon);
	}
}